/*
 * Description: The Main class conatins the calls to every example in the project
 * please add here your examples.
 */

package exampleseverything;

import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import exampleseverything.poi_jxls.ExcelGenerator1;
import exampleseverything.poi_jxls.FormatterXl;
import net.sf.jxls.exception.ParsePropertyException;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
/**
 *
 * @author HellCoders
 */
public class Main {

    //shows the main menu for the application
    //TODO if you have added some new examples please add the option to
    //     your main class here in the application menu
    private static void menu()throws IOException, ParsePropertyException, InvalidFormatException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("Enter the number of the option you want to run.");
        System.out.println("**************************************************");
        System.out.println("***            EXAMPLES EVERYTHING             ***");
        System.out.println("**************************************************");
        System.out.println("***            1. Dynamic Columns              ***");
        System.out.println("***            2. Formatting Report            ***");
        System.out.println("***            3. Exit                         ***");
        System.out.println("***                                            ***");
        System.out.println("**************************************************");
        System.out.print("Enter your option: ");
        int option = Integer.parseInt(br.readLine());

        switch(option) {
            case 1:
                System.out.println("This example fills a  excel report using the template created, \n" +
                        " reading the data from a couple of text files.");
                ExcelGenerator1.generateReport();
                System.out.println("The report was generated please verify the output file src/files/output1.xls \n");
                menu();
            break;
            case 2:
                FormatterXl.formatReport();
                menu();
            break;
            case 3:
                System.exit(0);
            break;
            default:
                System.out.println("You must select one of the option in the menu\n");
                menu();
            break;
        }
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)throws IOException, ParsePropertyException, InvalidFormatException {
        //fill the alumnos file with data
        exampleseverything.utils.FilesOp.generateData();
        menu();
    }

}
